//-------------------------------------------------------------------
//	Copyright (c) 2010-2012 Zhirnov Andrey
//	This file is part of the "UXGEN" project.
//	See copyright notice in "Engine.h".
//-------------------------------------------------------------------

#ifndef _UX_RESOURCE_LOAD_OPERATION_H
#define _UX_RESOURCE_LOAD_OPERATION_H

#include "../Threads/IThreadOperation.h"
#include "../../Resources/CResource.h"

namespace Engine
{
namespace CoreSystems
{

	//
	// Resource Load Operation
	//

	class _EXPORT_ CResLoadOperation : public IOperation, public CEngBaseObject
	{
	private:
		CResourcePtr	_pTemp,
						_pLoad;
		IFilePtr		_pFile;

	public:
		CResLoadOperation();
		~CResLoadOperation();

		void Create(const CResourcePtr &pTemp, const CResourcePtr &pLoad, const IFilePtr &pFile = nullptr);
		
		// IOperation //
		virtual void SetThread(IThread *pThread)	{ return; }
		virtual void Do();
		virtual bool Sync()							{ return true; }
		virtual bool NeedSync()						{ return false; }

		// CEngBaseObject //
		virtual void Release()						{}
	};


	//
	// Resource Replace Operation
	//

	class _EXPORT_ CResReplaceOperation : public IOperation, public CEngBaseObject
	{
	private:
		CResourcePtr	_pTemp,
						_pLoad;

	public:
		CResReplaceOperation();
		~CResReplaceOperation();
		
		void Create(const CResourcePtr &pTemp, const CResourcePtr &pLoad);
		
		// IOperation //
		virtual void SetThread(IThread *pThread)	{ return; }
		virtual void Do();
		virtual bool Sync()							{ return true; }
		virtual bool NeedSync()						{ return false; }

		// CEngBaseObject //
		virtual void Release()						{}
	};

//-------------------------------------------------------------------

}	// CoreSystems
}	// Engine

#endif	// _UX_RESOURCE_LOAD_OPERATION_H